<?php
namespace app\admin\model;
use think\Model;
class Setconfig extends Model
{
	//系统设置
	public function index(){
		$data = db('set')->field('allodds,return,status,content')->select();
		return $data;
	}

	//赔率与返水率的设置
	public function set(){
		$id = 1;
		$data['allodds'] = input('post.allodds');
		$data['return'] = input('post.return');
		$data['content'] = input('post.content');
		$data['updatetime'] = date('Y-m-d H:i:s');
		$data['status'] = input('post.status');
        $datas = db('set')->where('id',$id)->setField($data);
        $qi = db('result')->limit(1)->order('id desc')->select();
        $time = strtotime($qi[0]['time']);
        $times = date('Y-m-d H:i:',$time);
        $timess = $times.$data['return'];
        $up = db('result')->where('id',$qi[0]['id'])->setField('time',$timess);
        if($datas && $up){
        	$content = '修改了系统设置';
        	admin_log($content);
        	return 1;
        }else{
        	//修改失败
        	return 401;
        }
	}
}